export const link = document.createElement( 'a' );

export class PrefabLoader {

    private static __save( blob: Blob, filename: string ) {

		if ( link.href ) {

			URL.revokeObjectURL( link.href );

		}

		link.href = URL.createObjectURL( blob );
		link.download = filename || 'data.json';
		link.dispatchEvent( new MouseEvent( 'click' ) );

	}

   

    static saveString( text: string, filename: string ) {
		PrefabLoader.__save( new Blob( [ text ], { type: 'text/plain' } ), filename );
	}
}
